aboutsummaryrefslogtreecommitdiff
path: root/src/routes/player/[player]
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-06-17 14:55:34 -0500
committermat <github@matdoes.dev>2022-06-17 14:55:34 -0500
commit90f4b2c916cdd7f61843c7a2c7f4451d44e18367 (patch)
tree887d5120cbd7823345183ee5556f72a538c57ea4 /src/routes/player/[player]
parentb68a711c131d29a396440f2f76963ec5593aa3e7 (diff)
downloadskyblock-stats-90f4b2c916cdd7f61843c7a2c7f4451d44e18367.tar.gz
skyblock-stats-90f4b2c916cdd7f61843c7a2c7f4451d44e18367.tar.bz2
skyblock-stats-90f4b2c916cdd7f61843c7a2c7f4451d44e18367.zip
Fix being ratelimited sometimes
Diffstat (limited to 'src/routes/player/[player]')
-rw-r--r--src/routes/player/[player]/[profile].svelte7
-rw-r--r--src/routes/player/[player]/index.svelte4
2 files changed, 6 insertions, 5 deletions
diff --git a/src/routes/player/[player]/[profile].svelte b/src/routes/player/[player]/[profile].svelte
index bc6c18d..544d3c4 100644
--- a/src/routes/player/[player]/[profile].svelte
+++ b/src/routes/player/[player]/[profile].svelte
@@ -1,13 +1,14 @@
<script lang="ts" context="module">
import type { Load } from '@sveltejs/kit'
import { loadPack } from '$lib/packs'
- import { API_URL } from '$lib/api'
+ import { fetchApi } from '$lib/api'
export const load: Load = async ({ params, fetch }) => {
const player: string = params.player
const profile: string = params.profile
- const data: CleanMemberProfile = await fetch(
- `${API_URL}player/${player}/${profile}?customization=true`
+ const data: CleanMemberProfile = await fetchApi(
+ `player/${player}/${profile}?customization=true`,
+ fetch
).then(async r => {
const text = await r.text()
try {
diff --git a/src/routes/player/[player]/index.svelte b/src/routes/player/[player]/index.svelte
index a04086d..b95ef8a 100644
--- a/src/routes/player/[player]/index.svelte
+++ b/src/routes/player/[player]/index.svelte
@@ -1,11 +1,11 @@
<script lang="ts" context="module">
import type { Load } from '@sveltejs/kit'
- import { API_URL } from '$lib/api'
+ import { fetchApi } from '$lib/api'
export const load: Load = async ({ params, fetch }) => {
const player: string = params.player
- const data = await fetch(`${API_URL}player/${player}?customization=true`).then(r => r.json())
+ const data = await fetchApi(`player/${player}?customization=true`, fetch).then(r => r.json())
if (!data.player) {
return {